<?php 
$req_path="";
//require_once($req_path."./includes/db2.php");

class M_StudentDB extends DB2{
    private $rowCount=0;
    public $table_name="";
	
    function M_StudentDB(){
		parent::__construct();
	
    }
	function loadStudentData($id){
		$sql = " SELECT student_id , DATE_FORMAT(birthdate,'%d/%m/%Y') as birth_day,
				DATE_FORMAT(now(),'%Y') - DATE_FORMAT(birthdate,'%Y') as age,
				DATE_FORMAT(now(),'%m') - DATE_FORMAT(birthdate,'%m') as age_month,
				thai_name,	thai_surname ,	thai_nickname,
				eng_name,	eng_surname,	eng_nickname,
				sex,	religion,	race,	nationality ,
				birthdate,	address,	privince ,	zipcode ,
				telephone,	mobilephone ,	email ,
				emergency_contact,	no_of_brother1,	brother_1,	brother_2,	brother_3,
				no_of_brother2,	brother_4,	brother_5,	brother_6,
				blood ,	food_allergies,	be_allergic ,
				map,	congenital_disease ,	special_character ,
				parent_status ,	parent_status_remak ,
				father_name,	father_surname ,
				father_age,	father_education,
				father_position,	father_occupation,
				father_occupation_info ,	father_company ,
				father_company_address,	father_province,
				father_zipcode,	father_tele ,
				father_fax ,	mather_name,
				mather_surname,	mather_age ,
				mather_education,	mather_position,
				mather_occupation ,	mather_occupation_info,
				mather_company ,	mather_company_adress ,
				mather_province ,	mather_zipcode ,	mather_tele ,	mather_fax ,
				free_assetment ,	free_term ,	free_other1,	free_other2 ,
				bus,	bus_payment ,	free_student_form ,
				free_assetment+free_term+ifnull(free_other1,0) + ifnull(free_other2,0) + ifnull(bus_payment,0) +  ifnull(free_student_form,0) as Total,
				init_class,	suggessted ,	doc_idcard,
				doc_address ,	doc_birth,	doc_pic_chident,
				doc_pic_parent ,	doc_healty ,
				 createdate,	createby,	updatedate,	updateby ,DATE_FORMAT(registerdate,'%d/%m/%Y') registerdate
				,tele_parent_1,tele_parent_2,tele_parent_3
				 FROM tb_student_info
				 where 1=1  AND student_id=".$id;
		 //print_r($sql);
		$result = $this->ExecuteData($sql);
        $this->rowCount = $result->RecordCount();
		 
        return $result->FetchRow();
	}
}
?>
